package com.xinlianshiye.im.bean

import com.fasterxml.jackson.annotation.JsonIgnore
import org.hibernate.annotations.CreationTimestamp
import java.util.*
import javax.persistence.*

/**
 * @Author zw
 * @Description 好友分组表
 * @Date 14:56 2019/8/6
 * @Param
 */
@Entity
@Table(name = "im_group")
class UserGroup: Domain() {

    @ManyToOne
    @JoinColumn(name = "`usr`", foreignKey = ForeignKey(name = "none", value = ConstraintMode.NO_CONSTRAINT))
    var user: User? = null

    @Column(name = "name", columnDefinition = "varchar(255) comment '名称'")
    var name: String? = null

    @ManyToMany
    @JoinTable(name = "im_friends", joinColumns = [JoinColumn(name = "groupfriends")], inverseJoinColumns = [JoinColumn(name = "friend")])
    @JsonIgnore
    var friends: List<User>? = null
}